﻿@{
  
    Layout = "~/Areas/Shared/_spListV1.cshtml";
    ViewBag.ListActionURL = Url.Action("ContentListFunction", "Content", new { area = "CMS" });
    ViewBag.AddActionURL = Url.Action("AddContentFunction", "Content", new { area = "CMS" });
    ViewBag.DelActionURL = Url.Action("DelContentFunction", "Content", new { area = "CMS" });
    ViewBag.EditActionURL = Url.Action("EditContentFunction", "Content", new { area = "CMS" });

    ViewBag.Title = "新闻列表";
    Layout = "~/Areas/Shared/_spListV1.cshtml";

    ViewBag.IdColumn = "Id";
    ViewBag.NameColumn = "ContentTitle";
    ViewBag.ListSortName = "";
    ViewBag.ListSortOrder = "";
    ViewBag.AddWindowTitle = "添加新闻";
    ViewBag.EditWindowTitle = "编辑新闻";   
}

@section Script
{
    <script type="text/javascript">

        config.GridOption.toolbar = "#tb";
        config.GridOption.singleSelect = false;
        config.GridOption.columns = [[
            { field: 'ContentTitle', title: '标题', width: 240, sortable: true },
            { field: 'SecondTitle', title: '副标题', width: 150, sortable: true },
            { field: 'ContentSummary', title: '摘要', width: 100, sortable: true },
            { field: 'ContentKeywords', title: '关键字', width: 150, sortable: true },
            { field: 'CreateTime', title: '发布日期', width: 100, sortable: true, formatter: Common.DateTimeFormatter },
            {
                field: '操作',
                title: '操作',
                width: 60,
                formatter: function(value, row, rowIndex) {
                    var arr = new Array();

                    arr.push('<a href=# class="OpertaionButton"  onclick=EditItem("' + rowIndex + '")>[编辑]</a>');

                    arr.push('<a href=# class="OpertaionButton"  onclick=DelItem("' + rowIndex + '") > [删除] </a> ');
                    return arr.join('');
                }
            }
        ]];
 
    </script>
}
<div data-options="region:'west',split:true" title="分类" style="width: 200px;">
    <ul class="easyui-tree" id="CategoryTree">
    </ul>
</div>
<div id="tb">
      <div style="margin-bottom: 5px">
        <table cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true">新增</a>
                </td>
             
                <td>
                    <div class="datagrid-btn-separator">
                    </div>
                </td>
                <td>
                    <a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true">删除</a>
                </td>
            </tr>
        </table>
    </div>
 
 
</div>



<script type="text/javascript">

    var addactionUrl ='' ;
    $(function () {
        $('#CategoryTree').tree({
            url: '@Url.Action("GetCategoryTree", "Category", new { area = "CMS", Code = "0" })',
            onClick: function (node) {
                 
                config.AddActionURL = '@Url.Action("AddContentFunction", "Content", new { area = "CMS" })?categoryId=' + node.id;
                grid.datagrid({ url: config.ListActionURL, queryParams: { Code: node.id } });
   
            },
            onLoadSuccess: function () {

                var node = $('#CategoryTree').tree('find', $("#Code").val());
                if (node != null) {
                    $('#CategoryTree').tree('select', node.target);
                }
            }
        });

     



        

    });
 

  


 
</script>
